﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using NursingFormSystem;

namespace NursingFormSystem
{
    /// <summary>
    /// 网格线标题行信息
    /// </summary>
    [Serializable]
    [System.Xml.Serialization.XmlType]
    [System.Runtime.InteropServices.ComVisible(false)]
    public class TitleLineInfo
    {
        /// <summary>
        /// 初始化对象
        /// </summary>
        public TitleLineInfo()
        {
        }

        /// <summary>
        /// 初始化对象
        /// </summary>
        /// <param name="text"></param>
        /// <param name="dtmStart"></param>
        /// <param name="style"></param>
        /// <param name="startDateKeyword"></param>
        public TitleLineInfo(string text, DateTime dtmStart, TitleLineValueType style, string startDateKeyword, int Splits, string ShowType, string MergeName)
        {
            this.Text = text;
            this.StartDate = dtmStart;
            this.ValueType = style;
            this.StartDateKeyword = startDateKeyword;
            this.Splits = Splits;
            this.ShowType = ShowType;
            this.MergeName = MergeName;
        }

        /// <summary>
        /// 初始化对象
        /// </summary>
        /// <param name="text"></param>
        /// <param name="dtmStart"></param>
        /// <param name="style"></param>
        /// <param name="startDateKeyword"></param>
        public TitleLineInfo(string text, DateTime dtmStart, TitleLineValueType style, int Splits, string ShowType, string MergeName)
        {
            this.Text = text;
            this.StartDate = dtmStart;
            this.ValueType = style;
            this.Splits = Splits;
            this.ShowType = ShowType;
            this.MergeName = MergeName;
        }

        private string _Text = null;
        /// <summary>
        /// 标题文本
        /// </summary>
        [DefaultValue(null)]
        public string Text
        {
            get
            {
                return _Text;
            }
            set
            {
                _Text = value;
            }
        }

        private DateTime _StartDate = TemperatureDocument.NullDate;
        /// <summary>
        /// 开始计算的日期
        /// </summary>
        [DefaultValue(typeof(DateTime), TemperatureDocument.NullDateString)]
        public DateTime StartDate
        {
            get
            {
                return _StartDate;
            }
            set
            {
                _StartDate = value;
            }
        }

        private string _StartDateKeyword = null;
        /// <summary>
        /// 判断开始计算日期的关键字
        /// </summary>
        [DefaultValue(null)]
        public string StartDateKeyword
        {
            get
            {
                return _StartDateKeyword;
            }
            set
            {
                _StartDateKeyword = value;
            }
        }

        private int _Splits = 1;
        /// <summary>
        /// 判断开始计算日期的关键字
        /// </summary>
        [DefaultValue(1)]
        public int Splits
        {
            get
            {
                return _Splits;
            }
            set
            {
                _Splits = value;
            }
        }

        private DateTime _RuntimeStartDate = TemperatureDocument.NullDate;
        /// <summary>
        /// 运行时使用的开始计算的日期
        /// </summary>
        [Browsable(false)]
        [System.Xml.Serialization.XmlIgnore]
        public DateTime RuntimeStartDate
        {
            get
            {
                return _RuntimeStartDate;
            }
            set
            {
                _RuntimeStartDate = value;
            }
        }

        private List<DateTime> _InRuntimeStartDate = new List<DateTime>();
        /// <summary>
        /// 手术/产后  运行时使用的开始计算的日期集合
        /// </summary>
        [Browsable(false)]
        [System.Xml.Serialization.XmlIgnore]
        public List<DateTime> InRuntimeStartDate
        {
            get
            {
                return _InRuntimeStartDate;
            }
            set
            {
                _InRuntimeStartDate = value;
            }
        }

        private TitleLineValueType _ValueType = TitleLineValueType.SerialDate;
        /// <summary>
        /// 样式
        /// </summary>
        [DefaultValue(TitleLineValueType.SerialDate)]
        public TitleLineValueType ValueType
        {
            get
            {
                return _ValueType;
            }
            set
            {
                _ValueType = value;
            }
        }

        private string _ShowType = "";
        /// <summary>
        /// 样式
        /// </summary>
        [DefaultValue("")]
        public string ShowType
        {
            get
            {
                return _ShowType;
            }
            set
            {
                _ShowType = value;
            }
        }

        private string _MergeName = "";
        /// <summary>
        /// 合并的Id号，同一Id号合并
        /// </summary>
        [DefaultValue("")]
        public string MergeName
        {
            get
            {
                return _MergeName;
            }
            set
            {
                _MergeName = value;
            }
        }

        /// <summary>
        /// 标题行在文档视图中的Y坐标值
        /// </summary>
        [NonSerialized]
        internal float Top = float.NaN;

        internal string GetText(FooterMeasure cm)
        {
            switch (this.ValueType)
            {
                case TitleLineValueType.Abdomen_Circumference:
                    return cm.Abdomen_Circumference;
                case TitleLineValueType.Blood_Pressure:
                    return cm.Blood_Pressure;
                case TitleLineValueType.WeightAndHeight:
                    return cm.WeightAndHeight;
                case TitleLineValueType.Height:
                    return cm.Height;
                case TitleLineValueType.Weight:
                    return cm.Weight;
                case TitleLineValueType.Liquid_In:
                    return cm.Liquid_In;
                case TitleLineValueType.Liquid_Out:
                    return cm.Liquid_Out;
                case TitleLineValueType.Pee:
                    return cm.Pee;
                case TitleLineValueType.Stool:
                    return cm.Stool;
                case TitleLineValueType.FBreath:
                    return cm.FBreath;
                case TitleLineValueType.In_Take:
                    return cm.In_Take;
                case TitleLineValueType.Input:
                    return cm.Input;
                case TitleLineValueType.Skin_Test:
                    return cm.Skin_Test;
                case TitleLineValueType.LedTraffic:
                    return cm.LedTraffic;
                case TitleLineValueType.Others:
                    return cm.Others;
                case TitleLineValueType.DrugSensitivityTest:
                    return cm.DrugSensitivityTest;
                case TitleLineValueType.DrugAllergy:
                    return cm.DrugAllergy;
                case TitleLineValueType.FeedMode:
                    return cm.FeedMode;
                case TitleLineValueType.MilkIntake:
                    return cm.MilkIntake;
                case TitleLineValueType.VomitAmout:
                    return cm.VomitAmout;
                case TitleLineValueType.UrineTimes:
                    return cm.UrineTimes;
                case TitleLineValueType.StoolCharacter:
                    return cm.StoolCharacter;
                case TitleLineValueType.StoolTimes:
                    return cm.StoolTimes;
                case TitleLineValueType.BabyWeight:
                    return cm.BabyWeight;
                case TitleLineValueType.Blank_Line:
                    return cm.Blank_Line;
                case TitleLineValueType.Blank_Line1:
                    return cm.Blank_Line1;
                case TitleLineValueType.Blank_Line2:
                    return cm.Blank_Line2;
                case TitleLineValueType.Blank_Line3:
                    return cm.Blank_Line3;
                case TitleLineValueType.Blank_Line4:
                    return cm.Blank_Line4;
                case TitleLineValueType.Blank_Line5:
                    return cm.Blank_Line5;
                case TitleLineValueType.Blank_Line6:
                    return cm.Blank_Line6;
                case TitleLineValueType.Blank_Line7:
                    return cm.Blank_Line7;
                case TitleLineValueType.Blank_Line8:
                    return cm.Blank_Line8;
                case TitleLineValueType.Blank_Line9:
                    return cm.Blank_Line9;
                case TitleLineValueType.Blank_Line10:
                    return cm.Blank_Line10;
            }
            return null;
        }
    }

    /// <summary>
    /// 标题行数据类型
    /// </summary>
    [System.Runtime.InteropServices.ComVisible(false)]
    public enum TitleLineValueType
    {
        /// <summary>
        /// 一系列的日期数
        /// </summary>
        SerialDate,
        /// <summary>
        /// 住院日数
        /// </summary>
        InDayIndex,
        /// <summary>
        /// 天数
        /// </summary>
        DayIndex,
        /// <summary>
        /// 产后日数
        /// </summary>
        ChildBirthDay,
        /// <summary>
        /// 小时刻数
        /// </summary>
        HourTick,
        /// <summary>
        /// 文本
        /// </summary>
        Text,
        /// <summary>
        /// 尿量
        /// </summary>
        Pee,
        /// <summary>
        /// 粪便量
        /// </summary>
        Stool,
        /// <summary>
        /// 液体输入
        /// </summary>
        Liquid_In,
        /// <summary>
        /// 液体输出
        /// </summary>
        Liquid_Out,
        /// <summary>
        /// 血压
        /// </summary>
        Blood_Pressure,
        /// <summary>
        /// 身高
        /// </summary>
        Height,
        /// <summary>
        /// 体重
        /// </summary>
        Weight,
        /// <summary>
        /// 腹围
        /// </summary>
        Abdomen_Circumference,
        /// <summary>
        /// 体重/身高
        /// </summary>
        WeightAndHeight,
        /// <summary>
        /// 药物过敏
        /// </summary>
        DrugAllergy,
        /// <summary>
        /// 呼吸
        /// </summary>
        FBreath,
        /// <summary>
        /// 摄入量
        /// </summary>
        In_Take,
        /// <summary>
        /// 输入量
        /// </summary>
        Input,
        /// <summary>
        /// 皮试结果
        /// </summary>
        Skin_Test,
         /// <summary>
        /// 药敏试验
        /// </summary>
        DrugSensitivityTest,
        /// <summary>
        /// 喂养方式
        /// </summary>
        FeedMode,
        /// <summary>
        /// 进奶次数
        /// </summary>
        MilkIntake,
        /// <summary>
        /// 呕吐
        /// </summary>
        VomitAmout,
        /// <summary>
        /// 尿次
        /// </summary>
        UrineTimes,
        /// <summary>
        /// 大便性状
        /// </summary>
        StoolCharacter,
        /// <summary>
        /// 大便次数
        /// </summary>
        StoolTimes,
        /// <summary>
        /// 婴儿体重
        /// </summary>
        BabyWeight,
        /// <summary>
        /// 空行
        /// </summary>
        Blank_Line,
        /// <summary>
        /// 空行1
        /// </summary>
        Blank_Line1,
        /// <summary>
        /// 空行2
        /// </summary>
        Blank_Line2,
        /// <summary>
        /// 空行3
        /// </summary>
        Blank_Line3,
        /// <summary>
        /// 空行4
        /// </summary>
        Blank_Line4,
        /// <summary>
        /// 空行5
        /// </summary>
        Blank_Line5,
        /// <summary>
        /// 空行6
        /// </summary>
        Blank_Line6,
        /// <summary>
        /// 空行7
        /// </summary>
        Blank_Line7,
        /// <summary>
        /// 空行8
        /// </summary>
        Blank_Line8,
        /// <summary>
        /// 空行9
        /// </summary>
        Blank_Line9,
        /// <summary>
        /// 空行10
        /// </summary>
        Blank_Line10,
        /// <summary>
        /// 引流量
        /// </summary>
        LedTraffic,
        /// <summary>
        /// 其他
        /// </summary>
        Others,
    }
}
